#!/usr/bin/env python
#_*_coding:utf-8 _*_
__author__ = 'silence'
import sys,time
import user_operate,card_menu

def login_choice():
    while True:
        print u'''根据数字选择注册或登录
+++++++++++++++++++++++++++
|  1.注册         2.登录   |
+++++++++++++++++++++++++++
'''
        choice_login = raw_input(u"请输入选择(1|2|exit退出):").strip()
        if choice_login == "1":
            #调用注册模块
            user_operate.register_status_info()
            continue
        elif choice_login == "2":
            login_info = user_operate.login_control()
            if login_info != None:
                return login_info[0],login_info[1]
            else:
                continue
        elif choice_login == "exit":
            print u"1秒钟后你将退出系统......"
            time.sleep(1)
            sys.exit()
        else:
            print u"输入有误，请重新选择！！",
            continue

if __name__ =="__main__":
    post_users = login_choice()
    if post_users != None:
        user = post_users[0]
        level = post_users[1]
        card_menu.operate_menu(user)
